Skip to content

feat(exec-broker): signed profile scope → BrokerPolicy bridge (reconciliation R2) - #309

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 10, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Description

Reconciliation R2 (design: kit-research/docs/research/pillar3-broker-reconciliation-5.0.md). The exec-broker's original policy source is an unsigned .kit-exec-broker.json. This adds the signed source: a bridge from the offline-verified profile [scope]/RoE (Pillar 4) to a BrokerPolicy, so the one canonical broker can be driven by a cryptographically attributable source. It's the shared provider the PreToolUse gates (R3) and kit doctor will consume.

Type of Change

  • New feature (non-breaking change that adds functionality)

Related Issues

Changes Made

  • src/exec-broker/profile-policy.ts — profileBrokerPolicy(cwd) → { regime, policy, detail }:
    • maps a verified [scope] onto a BrokerPolicy (egress.allow ← scope.egress, fs roots ← scope.fs resolved against cwd, default .; env.declared ← scope.secrets);
    • fail-closed, mirroring the profile's own semantics: no [scope] → regime none (imposes nothing — the caller may fall back to the JSON policy or run unmediated); [scope] verified → regime active with a governing policy; declared-but-unsigned/tampered/malformed → active with null policy (default-deny). Never throws.
  • src/exec-broker/profile-policy.test.ts — 6 tests (none / no-scope / verified-mapping incl. multi-root fs / unsigned / tampered / fs-default-root), via a throwaway KIT_IDENTITY_DIR.

Testing

Test Coverage

  • Added new tests (6)
  • All tests pass (npm test) — full suite 2719 pass / 0 fail (2713 baseline + 6)

Manual Testing

  1. npx tsc --noEmit → clean; npx eslint src → 0 errors.
  2. npm run build && node scripts/test.mjs → 2719 pass, 0 fail.

Breaking Changes

None / N/A — new module; not yet wired into runBrokered (see notes).

Checklist

  • All new code has test coverage
  • All tests pass locally (npm test)
  • No new warnings or errors introduced
  • No hardcoded secrets or sensitive data
  • Code has been self-reviewed

Performance Impact

  • No performance impact — pure module; consulted only where wired (R3 gates), one profile read + offline verify.

Reviewer Notes

Deliberately does not change runBrokered's activation trigger. The 4 governed MCP ops (tools.install/secrets.generate/fix/run) declare no effect contract today, so making a signed profile flip runBrokered to mediate would fail-closed-deny kit's own MCP tools under any signed scope — a real breaking interaction that's a separate product decision (flagged in the reconciliation note's open questions), not part of the dedup. R2 just provides the signed source; R3 points the PreToolUse gates at the canonical decisions.ts via this bridge (removing the duplicate decision core), and R4 deletes src/broker/scope.ts + needs.ts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2


Generated by Claude Code

…iliation R2)

The exec-broker's original policy source is an UNSIGNED .kit-exec-broker.json. This adds the
canonical SIGNED source (design: pillar3-broker-reconciliation-5.0.md):

- exec-broker/profile-policy.ts: profileBrokerPolicy(cwd) → { regime, policy } mapping the
  offline-verified profile [scope] (Pillar 4) onto a BrokerPolicy — egress.allow ← scope.egress,
  fs roots ← scope.fs (resolved against cwd; default '.'), env.declared ← scope.secrets.
  Fail-closed, mirroring the profile's own semantics: no [scope] → regime 'none' (imposes
  nothing; caller may fall back to JSON or run unmediated); verified → 'active' with a governing
  policy; declared-but-unsigned/tampered/malformed → 'active' with null (default-deny).

This is the shared signed provider the PreToolUse gates (R3) and kit doctor will consume, so the
one canonical broker can be driven by a cryptographically attributable source. Deliberately does
NOT change runBrokered's activation trigger — the MCP runtime picking up a signed scope interacts
with per-op effect-declaration (the 4 governed MCP ops declare none today) and is a separate
product decision, flagged in the reconciliation note. Never throws. 6 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit e0fc857 into main Jul 10, 2026
18 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 10, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants